# Python if语句示例

# 0. 布尔常量示例
is_active = True
if is_active:
    print("状态为活跃")

is_admin = False
if not is_admin:
    print("非管理员权限")

# 1. 基本if语句
age = 18
if age >= 18:
    print("您已成年")

# 2. if-else语句
num = 7
if num % 2 == 0:
    print("偶数")
else:
    print("奇数")

# 3. 多条件判断(if-elif-else)
score = 85
if score >= 90:
    print("优秀")
elif score >= 80:
    print("良好")
elif score >= 60:
    print("及格")
else:
    print("不及格")

# 4. 字符串判断
name = "Alice"
if name == "Alice":
    print("欢迎Alice")
elif name == "Bob":
    print("欢迎Bob")
else:
    print("欢迎新朋友")

# 5. 嵌套if语句
x = 10
y = 5
if x > 0:
    if y > 0:
        print("x和y都是正数")
    else:
        print("x是正数但y不是")
else:
    print("x不是正数")

# 6. 不等于条件判断
fruit = "apple"
if fruit != "orange":
    print("这不是橙子")

# 7. 使用and运算符
age = 25
income = 50000
if age >= 18 and income > 30000:
    print("符合贷款条件")

# 8. 使用or运算符
day = "Saturday"
if day == "Saturday" or day == "Sunday":
    print("今天是周末")

# 9. 使用not运算符
is_raining = False
if not is_raining:
    print("天气晴朗，适合外出")